package com.naiterui.ehp.bs.agent.controller.inner;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.agent.service.INoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客户管理
 * 
 * @author yangfuya
 * @since 2022/2/15
 */
@Slf4j
@Api(tags = "消息管理")
@RequiredArgsConstructor
@RestController
@RequestMapping("/inner/notice")
public class InnerNoticeController {
    private final INoticeService noticeService;

    @PostMapping("/send/single/{type}")
    @ApiOperation("单条发送消息")
    public void sendSingle(@PathVariable String type, String userId, String info) throws BusinessException {
        log.error("单条发送消息 userId:{}, type:{}, info:{}", userId, type, info);
        noticeService.sendSingleMessage(type, userId, info);
    }

    @PostMapping("/send/batch/{type}")
    @ApiOperation("批量发送消息")
    public void sendBatch(@PathVariable String type, String info) throws BusinessException {
        log.error("批量发送消息 type:{}, info:{}", type, info);
        noticeService.sendBatchMessage(type, info);
    }
}
